package com.ruoyi.vocationalmajor.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.vocationalmajor.domain.ExamVocationalMajor;
import com.ruoyi.vocationalmajor.service.IExamVocationalMajorService;
import com.ruoyi.volunteermajor.domain.ExamVolunteerMajor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "基础管理-高职专业")
@RestController
@RequestMapping("/vocationalmajor")
public class ExamVocationalMajorController {

    @Autowired
    private IExamVocationalMajorService vocationalMajorService;

    /**
     * 查询高职专业列表
     */
                @ApiOperation("高职专业管理 - 分页查询列表")
    @GetMapping("/list")
    public AjaxResult list() {
        List<ExamVocationalMajor> list = vocationalMajorService.selectVocationalMajorList();
        return AjaxResult.success(list);
    }

    /**
     * 根据ID获取高职专业详情
     */
                @ApiOperation("高职专业管理 - 根据ID获取详细信息")
    @GetMapping("/info")
    public AjaxResult getInfo(@RequestParam Long id) {
        return AjaxResult.success(vocationalMajorService.selectVocationalMajorById(id));
    }

    /**
     * 根据学院ID查询专业列表
     */
                @ApiOperation("高职专业管理 - 根据学院ID查询列表")
    @GetMapping("/listByCollegeId")
    public AjaxResult listByCollegeId(@RequestParam Long collegeId) {
        List<ExamVocationalMajor> list = vocationalMajorService.selectVocationalMajorListByCollegeId(collegeId);
        return AjaxResult.success(list);
    }


    /**
     * 新增高职专业
     */
                @ApiOperation("高职专业管理 - 新增数据")
    @PostMapping
    public AjaxResult add(@RequestBody ExamVocationalMajor vocationalMajor) {
        return AjaxResult.success(vocationalMajorService.insertVocationalMajor(vocationalMajor));
    }

    /**
     * 修改高职专业
     */
                @ApiOperation("高职专业管理 - 修改数据")
    @PutMapping
    public AjaxResult edit(@RequestBody ExamVocationalMajor vocationalMajor) {
        return AjaxResult.success(vocationalMajorService.updateVocationalMajor(vocationalMajor));
    }

    /**
     * 删除高职专业
     */
                @ApiOperation("高职专业管理 - 删除数据")
    @DeleteMapping
    public AjaxResult remove(@RequestParam Long id) {
        return AjaxResult.success(vocationalMajorService.deleteVocationalMajorById(id));
    }
}
